import React, { Component } from 'react';
import { Form, Select, Input, Button, Modal } from 'antd';
import axios from 'axios';
import store from '../../../redux/index';
const FormItem = Form.Item;
const Option = Select.Option;

var defaultValues = [];
class authorize extends Component {
  constructor(props) {
    super(props);
    this.state = {
      infor: {}
    };
  }
    handleChange=(value) => {
      this.setState({ choiceKey: value });
    }

    render() {
      const { visible, onCancel, onCreate, form } = this.props;
      const { getFieldDecorator } = form;
      return (
        <Modal
          visible={visible}
          title="授权服务"
          okText="确定"
          cancelText="取消"
          onCancel={onCancel}
          onOk={onCreate}
          // onOk={onCreate.bind(this,this.state.choiceKey,this)}
        >
          <Form>
            <FormItem
              label="允许访问服务"
              labelCol={{ span: 5 }}
              wrapperCol={{ span: 16 }}
            >
              {getFieldDecorator('name', {
                rules: [{ required: false, message: '请输入服务关键词!', }],
                initialValue: store.getState()['getDefaultList'].defaultKeys
              })(
                <Select
                  mode="multiple"
                  style={{ width: '100%' }}
                  placeholder="请输入服务关键词"
                  // onChange={this.handleChange}
                  // defaultValue={['a']}
                  // defaultValue={store.getState()["getDefaultList"].defaultKeys}
                  // value={this.props.authsizeList}
                >
                  {
                    store.getState()['getList'].children.map((item, key) => {
                      return <Option key={item.name}>{item.name}</Option>;
                    })
                  }
                </Select>
              )}

            </FormItem>

          </Form>
        </Modal>
      );
    }

}
const Authorize = Form.create()(authorize);
export default Authorize;